import logo from '../logo.svg';
import React from 'react'
import './App.css';
// 引入相关的组件
import {Prompt,Switch,NavLink,Link ,withRouter ,Route,Redirect} from 'react-router-dom';
import {UserOutlined,ShoppingCartOutlined} from "@ant-design/icons"
import { Spin } from "antd";


import Index from '../component/index/index.js'
import Mask from '../component/mask'
class App extends React.Component {
	
	
	  componentWillReceiveProps(nextProps) {
		  console.log("hello")
	    //当路由切换时
	    if (this.props.location !== nextProps.location) {
			console.log("路由切换了")  //过滤，只有跳转到指定路径，才调用loadingshow
	      window.scrollTo(0, 0);
	      this.props.loadingShow();
	    }
	  }
	
	 componentDidMount() {
	    this.props.loadingShow();
	  }
	  
 
 render(){

  return (	<Switch><div>
			{/*展示位置*/}
			<Route path="/index" component={Index}/>
			<Route path="/mask" component={Mask}/>
			</div></Switch>
  );
}}



export default withRouter(App);
